﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@model YTCMS.Domain.Entities.hotel
@using YTCMS.Core;
<link href="/Content/uploadify.css" rel="stylesheet" />
<script src="/Scripts/jquery.uploadify.js"></script>
<style type="text/css">
    .uploadify-button {
        /*background: url("/Content/img/upload1.png");*/
        border: 0;
        border-radius: 0;
        display: inline-block;
        margin-left: 1px;
        position: absolute;
        top: 0;
        left: 0;
    }

    .makefriend .tag .btn {
        width: 100%;
        height: 20px;
        border-radius: 0px;
        font-size: 12px;
        background-color: #fb9337;
        color: #fff;
        box-shadow: -2px 2px rgba(158, 153, 153, 0.47);
        margin: 0 10px 0 0;
        padding: 3px 6px;
        text-align: center;
        display: inline;
        white-space: normal;
    }

    .makefriend .btn {
        width: 100px;
        height: 40px;
        background-color: #d93467;
        border-radius: 8px;
        font-size: 18px;
        display: inline-block;
        box-shadow: -1px 1px #ddd;
    }

        .makefriend .btn:hover {
            background-color: #d93467;
        }
    /*.makefriend .modal-dialog{
      width: 320px;
      margin: 350px auto 0;
      text-align: center;
    }*/
    .makefriend .modal-content {
        width: 320px;
        padding: 30px 40px 20px;
        margin: 10% auto 0;
        text-align: center;
    }

    .makefriend .hislabel {
        width: 100%;
        /*text-align: left;*/
        font-size: 12px;
    }

    .makefriend .level {
        text-align: center;
    }

    .expdiv {
        padding: 4px;
        width: 80px;
        border: 1px solid #c8c8c8;
        float: left;
    }

    .expbtn {
        position: absolute;
        z-index: 2;
        margin: -15px 0px 0px 50px;
    }

        .expbtn a {
            display: block;
            width: 32px;
            height: 32px;
            background: #fff;
            background: url(/Content/img/Stop.png);
        }

    /*.expbtn a:hover {
        background: url(../images/btn_playbg.gif) left -16px;
    }*/
</style>
<script charset="utf-8" src="/Content/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="/Content/kindeditor/lang/zh_CN.js"></script>
<div class="page-content">
    <div class="page-header">
        <h1>
            酒店管理
            <small>
                <i class="icon-double-angle-right"></i>
                发布酒店
            </small>
        </h1>
    </div><!-- /.page-header -->

    <div class="row">
        <div class="col-xs-12">
            <form class="form-horizontal" id="form1" action="/Hotel/add" method="post">
                @Html.ValidationSummary(true)
                <div class="tabbable">
                    <ul class="nav nav-tabs" id="myTab">
                        <li class="active">
                            <a data-toggle="tab" href="#home">
                                <i class="green icon-home bigger-110"></i>
                                线路基本信息
                            </a>
                        </li>

                        <li class="" id="li_custom">
                            <a data-toggle="tab" href="#profile">
                                房型介绍
                                <span class="badge badge-danger">1</span>
                            </a>
                        </li>

                        <li class="dropdown" id="li_Hod">
                            <a data-toggle="tab" href="#Hod">
                                餐饮娱乐
                                <span class="badge badge-danger">1</span>
                            </a>


                        </li>
                    </ul>

                    <div class="tab-content">
                        <div id="home" class="tab-pane active">
                            <div class="widget-box">
                                <div class="widget-header">
                                    <div class="widget-toolbar">
                                        <a href="#" data-action="collapse">
                                            <i class="icon-chevron-up"></i>
                                        </a>

                                        <a href="#" data-action="close">
                                            <i class="icon-remove"></i>
                                        </a>
                                    </div>
                                </div>

                                <div class="widget-body">
                                    <div class="widget-main">
                                        <div>
                                            <label for="form-field-8">酒店名称</label>
                                            @Html.TextBoxFor(s => s.Name, new { @class = "form-control required" })
                                            @Html.ValidationMessageFor(s => s.Name)
                                        </div>
                                        <div>
                                            <label for="form-field-8">酒店星级</label>
                                            @Html.TextBoxFor(s => s.Leve, new { @class = "form-control required" })
                                            @Html.ValidationMessageFor(s => s.Leve)
                                        </div>
                                        <div>
                                            <label for="form-field-8">地区分类</label>
                                            <div class="row">
                                                <div class="col-md-3">
                                                    @Html.DropDownList("ddl1", Admin.Common.YTDDL.Category(s => s.Pid.Value == 0 && s.Level == 1 && s.State == (int)CommonState.正常, true), new { @class = "form-control", @onchange = "ddlonchange('ddl2','/Util/CategoryDDL',{pid:this.value},function(){$('#ddl3').empty().append('<option value=\"\">请选择</option>'); $('#CategoryId').val($('#ddl1').val())})" })
                                                </div>
                                                <div class="col-md-3">
                                                    <select class="form-control" id="ddl2" name="ddl2" onchange="javascript: $('#CategoryId').val(this.value)">
                                                        <option value="">请选择</option>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>
                                        <div>
                                            <label for="form-field-8">酒店图片</label>
                                            <input type="file" name="file_upload" id="file_upload" class="form-control" maxlength="200" />
                                            <div class="row">
                                                <div>
                                                    <div id="divimg">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div>
                                            <label for="form-field-8">详细地址</label>
                                            @Html.TextBoxFor(s => s.Address, new { @class = "form-control " })
                                            @Html.ValidationMessageFor(s => s.Address)
                                        </div>
                                        <div>
                                            <label for="form-field-8">酒店最低消费金额</label>
                                            @Html.TextBoxFor(s => s.MinConsume, new { @class = "form-control " })
                                            @Html.ValidationMessageFor(s => s.MinConsume)
                                        </div>
                                        <div>
                                            <label for="form-field-8">酒店房间数</label>
                                            @Html.TextBoxFor(s => s.SumRoom, new { @class = "form-control " })
                                            @Html.ValidationMessageFor(s => s.SumRoom)
                                        </div>
                                        <div>
                                            <label for="form-field-8">酒店床位数</label>
                                            @Html.TextBoxFor(s => s.SumBed, new { @class = "form-control " })
                                            @Html.ValidationMessageFor(s => s.SumBed)
                                        </div>
                                        <div>
                                            <label for="form-field-8">酒店是否包含早餐</label>
                                            @Html.RadioButtonFor(s => s.IsBreakfast,1) 是
                                            @Html.RadioButtonFor(s => s.IsBreakfast, 0, new { @checked = "checked" }) 否
                                        </div>
                                        <div>
                                            <label for="form-field-8">酒店是否包含午餐</label>
                                            @Html.RadioButtonFor(s => s.IsLunch, 1) 是
                                            @Html.RadioButtonFor(s => s.IsLunch, 0, new { @checked = "checked" }) 否
                                        </div>
                                        <div>
                                            <label for="form-field-8">酒店是否包含晚餐</label>
                                            @Html.RadioButtonFor(s => s.IsSupper, 1) 是
                                            @Html.RadioButtonFor(s => s.IsSupper, 0, new { @checked = "checked" }) 否
                                        </div>
                                        <div>
                                            <label for="form-field-8">酒店推荐</label>
                                            @Html.RadioButtonFor(s => s.IsPush, 1) 是
                                            @Html.RadioButtonFor(s => s.IsPush, 0, new { @checked = "checked" }) 否
                                        </div>
                                        <div>
                                            <label for="form-field-8">酒店描述</label>
                                            @Html.TextAreaFor(s => s.Remark, new { @class = "form-control", @style = "margin: 0px; width:100%; height: 85px;" })
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div id="profile" class="tab-pane">
                            <div class="widget-box">
                                <div class="widget-main">
                                    
                                    <div>
                                        <label for="form-field-8">房型介绍:</label>
                                       @Html.TextAreaFor(s => s.Remark2 ,new { @class = "form-control", @style = "margin: 0px; width: 1582px; height: 85px;" })
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div id="Hod" class="tab-pane">
                            <div class="widget-box">
                                <div class="widget-main">
                                    
                                    <div>
                                        <label for="form-field-8">餐饮娱乐:</label>
                                        @Html.TextAreaFor(s => s.Remark3, new { @class = "form-control", @style = "margin: 0px; width: 1582px; height: 85px;" })
                                    </div>

                                    <div>
                                        <button class="btn btn-info" id="btnSave" type="button" style="margin:10px 0 10px 0;">
                                            <i class="icon-ok bigger-110"></i>
                                            保存
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        @Html.Hidden("hidimg")
                        @Html.Hidden("CategoryId")
                    </div>
                </div>
            </form>



        </div><!-- /.col -->
    </div><!-- /.row -->
</div>
<script>
    var imgs = new Array();
    $(function () {
        $("#btnSave").click(function () {
            var b = jQuery("#form1").valid();
            if (b) {
                $("#hidimg").val(imgs.toString())
                $("#form1").submit();
            }
        });

        var editor, editor1, editor2;
        KindEditor.ready(function (K) {
            editor = K.create('#Remark', {
                uploadJson: '/Util/KindEditorHandlerFile',
                afterBlur: function () { editor.sync(); },
                allowFileManager: true
            });

        });
        $("#li_custom").click(function () {
            KindEditor.ready(function (K) {
                editor1 = K.create('#Remark2', {
                    uploadJson: '/Util/KindEditorHandlerFile',
                    afterBlur: function () { editor1.sync(); },
                    allowFileManager: true
                });
            });

        });
        $("#li_Hod").click(function () {
            KindEditor.ready(function (K) {
                editor3 = K.create('#Remark3', {
                    uploadJson: '/Util/KindEditorHandlerFile',
                    afterBlur: function () { editor3.sync(); },
                    allowFileManager: true
                });
            });
        });

    })

    setTimeout(function () {
        jQuery('#file_upload').uploadify({
            'swf': '/Scripts/uploadify.swf',
            'uploader': '/Util/ImgUploadByHotel',
            'fileTypeExts': '*.gif; *.jpg; *.png; *.bmp; *.jpeg',
            'multi': false,
            'fileObjName': 'filedata',
            'wmode': 'transparent',
            'fileSizeLimit': '2MB',
            'onSelectError': function (file, errorCode, errorMsg) {
                jAlert("文件大小超出系统限制的", "提示")
            },
            'onFallback': function () {
                jAlert("您未安装FLASH控件，无法上传图片！请安装FLASH控件后再试。", "提示");
            },
            onUploadSuccess: function (file, data, respone) {
                $("#divimg").append("<div class='expdiv'><div class='expbtn'><a href='javascript:void(0)' onclick='imgclose(this)' value='" + data + "'></a></div><img src='" + data + "' height='100px' width='80px' /></div>")
                imgs.push(data);
            }
        });
    }, 10);

    function imgclose(obj) {
        $(obj).parents(".expdiv").remove();
        imgs.remove($(obj).attr("value"));
    }
</script>